const {chromium} = require("playwright");
const path = require("path");
const fs = require("node:fs")

const start = async ()=>{
    const browser = await chromium.launch();
    const page = await browser.newPage()
    await page.goto("https://www.amazon.com/s?k=bowl");
    await page.waitForLoadState('load');
    await page.locator("span#nav-global-location-data-modal-action").click();
    await page.waitForSelector("input#GLUXZipUpdateInput.GLUX_Full_Width.a-declarative");
    await page.locator("input#GLUXZipUpdateInput.GLUX_Full_Width.a-declarative").fill("75584");
    // await page.locator("input[aria-labelledby='GLUXZipUpdate-announce']").click({force:true});
    // await page.waitForSelector("div#GLUXZipConfirmationSection");
    // await page.locator("button[name='glowDoneButton']").click();
    const content = await page.content();
    const fp = path.join(".","test.html")
    fs.writeFileSync(fp,content);
    await page.close();
}

start();